PROJECT(fog)

SET(SRCS src/main.cpp src/PerlinNoise.cpp)

SET(CG_SRCS Cg/vcolor.cg Cg/ftexture.cg)

SET(HDRS include/PerlinNoise.h include/TGAImg.h)

SOURCE_GROUP("Cg Files" REGULAR_EXPRESSION /*.cg$)
SOURCE_GROUP("Header Files" REGULAR_EXPRESSION /*.h$)
SOURCE_GROUP("Source Files" REGULAR_EXPRESSION /*.cpp$)

ADD_EXECUTABLE(fog ${SRCS} ${HDRS} ${CG_SRCS})

FIND_PACKAGE(OpenGL)
FIND_PACKAGE(GLUT)

## NVIDIA CG related packages
FIND_PATH(CG_INCLUDE_DIR Cg/cg.h
  "c:/Program Files/NVIDIA Corporation/Cg/include" 
  /usr/include
)

FIND_LIBRARY(CG_LIBRARY_CG
  NAMES cg
  PATHS /usr/lib /usr/local/lib "c:/Program Files/NVIDIA Corporation/Cg/lib"
)

FIND_LIBRARY(CG_LIBRARY_CG_GL
  NAMES cgGL
  PATHS /usr/lib /usr/local/lib "c:/Program Files/NVIDIA Corporation/Cg/lib"
)

SET(CG_LIBRARY ${CG_LIBRARY_CG} ${CG_LIBRARY_CG_GL})

IF(CG_INCLUDE_DIR)
  IF(CG_LIBRARY)
    SET( CG_FOUND "YES" )
  ENDIF(CG_LIBRARY)
ENDIF(CG_INCLUDE_DIR)

MARK_AS_ADVANCED(
  CG_LIBRARY
  CG_INCLUDE_DIR
)

INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/include
					${GLUT_INCLUDE_DIR}
					${CG_INCLUDE_DIR})
					
TARGET_LINK_LIBRARIES(fog 	${OPENGL_gl_LIBRARY} 
							${OPENGL_glu_LIBRARY}
							${GLUT_glut_LIBRARY}
							${CG_LIBRARY_CG_GL}
							${CG_LIBRARY_CG})